import bisect

data = [4,2,9,7]

print data

data.sort()

#bisect.insort(data, 3)

print data

# return the index but not  insert 
print bisect.bisect(data, 3), data

print bisect.bisect_left(data, 3), data
print bisect.bisect_left(data, 1), data
print bisect.bisect_right(data, 2), data

print bisect.insort_left(data, 3), data
